package ar.edu.unq.tpi.constriu.c1.tejeda.Dominio.Agenda;


import java.util.HashMap;
import java.util.Map;

/**
 * Clase que contiene a todos los {@link FilteredField}
 * @author nnydejesus
 */
public class FilterHome {
	private Map<Class, FilteredField> filters = new HashMap<Class, FilteredField>();
	private static FilterHome instance;
	private FilteredField defaultFiltered; 
	
	private FilterHome() {
		filters.put(String.class, new Stringfilter());
		defaultFiltered = new DefaultFilter();
	}
	
	public static  synchronized FilterHome getInstance(){
		if(instance == null){
			instance = new FilterHome();
		}
		return instance;
	}
	
	public FilteredField getFilter(Class clazz){
		if(filters.containsKey(clazz)){
			return filters.get(clazz);
		}else{
			return defaultFiltered;
		}
	}
}